$(function () {
    getPos();

})

var getPos = function () {
    Prepare({
        complete: function (location) {
            if (location.poiName) {
                console.log(location.poiName);
                $('.current-pos').find('span').text(location.poiName)
            }
            $.ajax({
                url: position_url + '/cmwsmdm-web/poi/getCommunityListByCityCode_1000173.html',
                dataType: 'jsonp',
                success: function (data) {
                    if (data.code == 1) {
                        var html = template('pos', data);
                        $('dl').append(html);
                        bindDt();
                    }
                    else {
                        AlertBox({
                            type: 'mini',
                            msg: '网络错误'
                        })
                    }
                }
            })
        }
    })

}
var bindDt = function () {
    $('dd').off('click').click(function () {
        var id = $(this).data('poiid');
        Util.setCookie('xd_poiId', id);
        Util.setCookie('xd_poiName', $(this).text())
        window.location.href = '/duimen/'
    })
}